WITH FD_VARIABLE_1 AS
  (SELECT ROW_NUMBER() OVER(ORDER BY T.ORDER_NUM ASC) RN, T.*
  FROM FD_VARIABLE T
  WHERE 1 = 1
<#if (TYPE_ID!) != ''>
  AND T.TYPE_ID = :TYPE_ID
</#if>
<#if (CODE!) != ''>
  AND (INSTR(T.CODE, :CODE)  > 0
  OR INSTR(T.NAME, :CODE)    > 0)
</#if>
  )
SELECT T.*, JD.NAME AS TYPE_NA
FROM FD_VARIABLE_1 T
JOIN FD_DICTIONARY JD ON (JD.ID = T.TYPE_ID)
WHERE T.RN BETWEEN :BEGIN__ROW__NUM AND :END__ROW__NUM